Overview
ThePhoenix.LiveView.Logger module provides automatic logging for Phoenix LiveView and LiveComponent lifecycle events using Telemetry. It logs mount, handle_params, and handle_event callbacks with parameter filtering support.
Installation
The logger is installed automatically when LiveView starts. By default, the log level is set to:debug.
Configuration
Module-Level Configuration
Override the log level for an individual LiveView module:Available Log Levels
:debug(default) - Logs all events:info- Logs at info level:warn- Logs warnings only:error- Logs errors onlyfalse- Disables logging for the module
Logged Events
The following Telemetry events are automatically logged:LiveView Events
[:phoenix, :live_view, :mount, :start]- LiveView mount begins[:phoenix, :live_view, :mount, :stop]- LiveView mount completes[:phoenix, :live_view, :handle_params, :start]- Handle params begins[:phoenix, :live_view, :handle_params, :stop]- Handle params completes[:phoenix, :live_view, :handle_event, :start]- Handle event begins[:phoenix, :live_view, :handle_event, :stop]- Handle event completes
LiveComponent Events
[:phoenix, :live_component, :handle_event, :start]- Component event begins[:phoenix, :live_component, :handle_event, :stop]- Component event completes
Log Format
Mount Logging
Start:Handle Params Logging
Start:Handle Event Logging
LiveView Event Start:Parameter Filtering
The logger automatically filters parameters based onPhoenix.Logger configuration.
Configure Parameter Filtering
In yourconfig.exs: